package service.impl;

import java.sql.SQLException;

import bean.Customer;
import dao.UserDao;
import dao.impl.UserDaoImpl;
import service.UserService;

public class UserServiceImpl implements UserService {
	UserDao userDao = new UserDaoImpl();
	//注册
	@Override
	public boolean regist(Customer user) {
		boolean succes = false;
		try {
			succes = userDao.insert(user);
		} catch (SQLException e) {
			e.printStackTrace();
		}		
		return succes;
	}

	//登录
	@Override
	public Customer login(Customer customer) {		
		try {
			return userDao.queryByNameAndPsw(customer.getcName(), customer.getcPassword());
		} catch (SQLException e) {
			e.printStackTrace();
		}		
		return null;
	}

	@Override
	public Customer queryById(String id) {
		return null;
	}

	@Override
	public Customer queryByName(String name) {
		return null;
	}

}
